/*
 *  include/asm/asmdef.h
 *
 *  last modified 2007.07.14 21:51 by ChenJie
 *
 */

#ifndef ASMDEF_H
#define ASMDEF_H

#define ENTRY(name) \
	.global name; \
	.align 2; \
	name:

#define SAVE_REGS() \
	pushl	%eax; \
	pushl	%ebx; \
	pushl	%ecx; \
	pushl	%edx; \
	pushl	%edi; \
	pushl	%esi; \
	pushl	%ebp; \
	push	%ds; \
	push	%es; \
	push	%fs; \
	push	%gs; \
	movw	$SELECTOR_KDS, %ax; \
	movw	%ax, %ds; \
	movw	%ax, %es; \
	movw	$SELECTOR_UDS, %ax; \
	movw	%ax, %fs; \
	movw	$SELECTOR_KGS, %ax; \
	movw	%ax, %gs; \
	movl	%esp, %ebp;

#define RESTORE_REGS() \
	pop	%gs;  \
	pop	%fs;  \
	pop	%es;  \
	pop	%ds;  \
	popl	%ebp; \
	popl	%esi; \
	popl	%edi; \
	popl	%edx; \
	popl	%ecx; \
	popl	%ebx; \
	popl	%eax; 

#define LEAVE() \
	iret;


#endif // ASMDEF_H
